package com.hailiang.reptile;


import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Md5Util {
        public static String getMd5String(String str) {
            try {
                MessageDigest messageDigest = MessageDigest.getInstance("md5");
                byte[] bytes = messageDigest.digest(str.getBytes("utf-8"));
                BigInteger bigInteger = new BigInteger(1, bytes);
                String md5 = bigInteger.toString(32);
                return md5;
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            return null;
        }
    }


